using JGSY.CMS.LowCode.Platform.Domain.Interfaces;

namespace JGSY.CMS.LowCode.Platform.Domain.Entities.Monitoring;

/// <summary>
/// 监控用户交互实体
/// 追踪用户在页面上的交互行为
/// </summary>
public class MonitorUserInteraction : ITenantEntity
{
    /// <summary>
    /// 主键ID
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 会话ID - 用于关联同一用户会话的交互
    /// </summary>
    public string SessionId { get; set; } = string.Empty;

    /// <summary>
    /// 交互类型 - click, scroll, route_change, page_visibility, form_submit
    /// </summary>
    public string InteractionType { get; set; } = string.Empty;

    /// <summary>
    /// 页面URL - 交互发生时的页面地址
    /// </summary>
    public string PageUrl { get; set; } = string.Empty;

    /// <summary>
    /// 目标元素 - CSS选择器或元素描述
    /// </summary>
    public string? TargetElement { get; set; }

    /// <summary>
    /// 元素文本内容
    /// </summary>
    public string? ElementText { get; set; }

    /// <summary>
    /// 路由来源页面 - 用于路由切换交互
    /// </summary>
    public string? RouteFrom { get; set; }

    /// <summary>
    /// 路由目标页面 - 用于路由切换交互
    /// </summary>
    public string? RouteTo { get; set; }

    /// <summary>
    /// 滚动深度 - 百分比，用于滚动交互
    /// </summary>
    public int? ScrollDepth { get; set; }

    /// <summary>
    /// 表单数据 - JSON 格式的表单交互数据（脱敏处理）
    /// </summary>
    public string? FormData { get; set; }

    /// <summary>
    /// 交互持续时间 - 毫秒为单位
    /// </summary>
    public int? Duration { get; set; }

    /// <summary>
    /// 时间戳 - JavaScript Date.now() 毫秒时间戳
    /// </summary>
    public long Timestamp { get; set; }

    /// <summary>
    /// 创建时间 - 数据库记录创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    /// <summary>
    /// 租户标识符
    /// </summary>
    public string TenantId { get; set; } = string.Empty;
}
